<script>
    var a = NaN == NaN;
    document.write(a); //false，非数不等于非数
</script>

typeof 数据类型
typeof() 显示数据类型以字符串的形式显示
typeof为Null的情况
<script type="text/javascript">
    var num = [];
    console.log(typeof(num));
    var num={};
    console.log(typeof(num));
    var num = null;
    console.log(typeof(num));
</script>



数据转换
<script>
    var num = Number ([]);
    console.log(typeof(num) + ':' + num);
    var num = Number ('123');
    console.log(typeof(num) + ':' + num);
    var num = Number('12a');
    console.log(typeof(num) + ':' + num);
    var num = Number('null');
    console.log(typeof(num) + ':' + num);
    
</script>

<script>
    // parseInt转为整数型
    var demo = 'b';
    var num = parseInt(demo,16); /*radix 2 - 36*/
    console.log(typeof(num) + ':' + num);

    var demo = '12.1b';
    var num = parseInt(demo)
    console.log(typeof(num) + ':' + num)

    // parseFloat 转为浮点数
    var a = '10.1';
    var num = parseFloat(a);
    console.log(typeof(num) + ':' + num);
</script>

boolean()转为布尔值  除undefined null string  NaN   "" 0 false 外其他转为true
<script>
    var a = null;
    var b = Boolean(a);
    document.write(typeof(b) + ':' + b);
</script>

null和undefined不能用 toString
    var num = demo.toString()

    toString(2) 括号加数字表示转为数字进制
<!-- 将2进制的1000转换为16进制 -->
    <script>
        var num = 1000;
        var test = parseInt(num,2);  /*以2进制为基底转化为十进制*/
        console.log(typeof(test) + ':' + test.toString(16));  /*转化为16进制*/
    </script>

    对象

    <script>
        var rao = {
            lastName : 'rao',
            age :25,
            sex : undefined,
            wife : 'xiao',
            handsome : true
        }

        console.log(rao.lastName);
        rao.lastName = 'old rao';
        console.log(rao.lastName);
        console.log(rao)
    </script>

